import service from '@/utils/request'

// 获取文章列表
export function getArticleListApi(articleQuery) {
  return service({
    url: '/article',
    method: 'get',
    params: articleQuery
  })
}

// 删除文章
export function delArticleApi(articleId) {
  return service({
    url: `/article/${articleId}`,
    method: 'delete'
  })
}

// 获得文章详情
export function getArticleDetailApi(articleId) {
  return service({
    url: `/article/${articleId}`,
    method: 'get'
  })
}

// 添加文章
export function addArticleApi(articleForm) {
  return service({
    url: '/article',
    method: 'post',
    data: articleForm
  })
}

// 修改文章
export function modifyArticleApi(articleForm) {
  const { id, ...form } = articleForm
  return service({
    url: `/article/${id}`,
    method: 'put',
    data: form
  })
}